<template>
	<div style="height: 1000px;">
		<div class="my-body">
		<div class="ipt_a">
				<div style="float: left; line-height: 30px; "  class="tab_font-size">合同编号：</div>
				<el-input v-model="input" placeholder="请输入内容"
					style=" width: 150px;height: 50px; float: left;"></el-input>
			</div>

			<div>
				<el-button type="primary" plain>查询</el-button>
				<el-button plain>清空</el-button>

			</div>
        </div>
	  <div>
		
	  </div>
  
	  <div style="width: 100%; height: 200px; float: left">
		<div>
		  <div style="width: 100%; height: 100%; float: left">
			<div class="my-body_center">
			  <div style="padding: 0 0 20px 0">
				<!-- <el-button type="primary" @click="zhuhetongtj()" plain
				  >添加主合同</el-button
				> -->
				<!-- <el-button type="danger" plain>删除(作废)主合同</el-button> -->
			  </div>
			  <div style="width: 100%; height: 100%; float: left">
				<template>
				  <el-table
					:data="tableData"
					border
					style="width: 100%; overflow: auto"
				   :header-cell-style="{background:'#f5f7fa',color:'#606266'}"
					max-height="300"
					ref="singleTablezhu"
					highlight-current-row
					@current-change="handleCuChangezhu"
				  >
					<el-table-column
					  fixed
					  prop="contract_code"
					  label="合同编号"
					  width="250"
					>
					</el-table-column>
					<el-table-column
					  prop="start_time"
					  label="合同起始时间"
					  width="200"
					>
					</el-table-column>
					<el-table-column
					  prop="end_time"
					  label="合同终止时间"
					  width="200"
					>
					</el-table-column>
					<el-table-column
					  prop="status_txt"
					  label="合同状态"
					  width="120"
					>
					<template slot-scope="scope">
					
						
					  <el-button  v-if="scope.row.is_operation  == 0">{{scope.row.status_txt}}</el-button>
						<el-button @click="fuhezhong(scope.$index, scope.row)" v-else>{{scope.row.status_txt}}</el-button>
					  
				  </template>
				  
					</el-table-column>
					<el-table-column
					  prop="track_number"
					  label="物流编号"
					  width="120"
					>
					<template slot-scope="scope">
						<el-input v-model="scope.row.track_number" placeholder="请输物流编号"
					></el-input>
				</template>
					</el-table-column>
					<el-table-column
					  prop="senddate"
					  label="回执倒计时"
					  width="120"
					>
					</el-table-column>
					<el-table-column
					  prop="create_time"
					  label="发布时间"
					  width="200"
					>
					</el-table-column>
					<el-table-column prop="senddate" label="回执时间" width="120">
					</el-table-column>
					<el-table-column prop="senddate" label="价格明细" width="120">
					  <el-button @click="mingxi()" type="text" size="mini"
						>明细</el-button
					  >
					</el-table-column>
					<el-table-column prop="senddate" label="合同上传" width="120">
					  <template slot-scope="scope">
					
					<el-button @click="zhuhetongsc(scope.$index, scope.row)" type="text" size="mini" v-if="scope.row. status ==2"
						>上传</el-button
					  >
					  <el-button @click="zhuhetongsc(scope.$index, scope.row)" type="text" size="mini" v-else
						>已上传</el-button
					  >
				  </template>
					 
					</el-table-column>
					<el-table-column prop="senddate" label="操作日志" width="120">
					  <template slot-scope="scope">
						<el-button @click="caozuorizhi(scope.$index, scope.row)" type="text" size="mini"
						>操作日志</el-button
					  >
				  
				  </template>
					 
					</el-table-column>
					<el-table-column label="操作" width="120">
					  <template slot-scope="scope">
						<el-button
						  type="text"
						  size="mini"
						  @click="handleEdit(scope.row)"
						>
						  <i class="el-icon-edit"></i>编辑</el-button
						>
					  </template>
					</el-table-column>
				  </el-table>
				  <el-pagination
					@size-change="handleSizeChange"
					@current-change="handleCurrentChange"
					:current-page="currentPage"
					:page-sizes="[5]"
					:page-size="pageSize"
					:total="tableData.length"
					layout="total, sizes, prev, pager, next, jumper"
				  >
				  </el-pagination>
				</template>
			  </div>
			</div>
			<el-dialog
			title="日志信息"
			:visible.sync="rizhixinxi"
			width="40%"
			:before-close="handleClose"
		  >
			<template>
			  <el-table :data="xinxilist" stripe style="width: 100%" height="400">
				<el-table-column prop="operation_type" label="操作类型" width="180">
				</el-table-column>
				<el-table-column prop="result_txt" label="状态" width="180">
				</el-table-column>
				<el-table-column prop="admin_name" label="操作人"> </el-table-column>
				<el-table-column prop="create_time" label="操作时间"> </el-table-column>
				<el-table-column prop="remark" label="备注信息"> </el-table-column>
			  </el-table> 
			</template>
		  </el-dialog>
			<div class="my-body_center_left">
			  <div
				style="width: 100%; height: 200px; float: left; margin-top: 20px"
			  >
				<div style="width: 100%; height: 200px; float: left">
				  <div>主合同授权医院或地区</div>
				  <div style="width: 100%; height: 100%">
					<el-table
					  :data="main_hospital"
					  border
					  height="300px"
					  :header-cell-style="{background:'#f5f7fa',color:'#606266'}"
					  style="width: 100%; margin-top: 20px; overflow: auto"
					  ref="zhuhetongsq"
					  highlight-current-row
					  @current-change="handlezhuhetongsq"
					>
					  <el-table-column
						fixed
						prop="hospital_name"
						label="医院或地区名称"
					  >
					  </el-table-column>
					  <el-table-column
						fixed
						prop="sc_target_num"
						label="商采指标"
					  >
					  </el-table-column>
					</el-table>
				  </div>
				</div>
				
			  </div>
			</div>
			<div class="my-body_center_left">
			  <div
				style="width: 100%; height: 200px; float: left; margin-top: 20px"
			  >
			  <div>
				<div style="width: 100%; height: 200px; float: left">
				  <div>主合同补充</div>
				  <div style="width: 100%; height: 100%">
					<el-table
					  :data="main_file_url"
					  border
					  height="300px"
					 :header-cell-style="{background:'#f5f7fa',color:'#606266'}"
					  style="width: 100%; margin-top: 20px; overflow: auto"
					>
					  <el-table-column fixed prop="ht_code" label="合同编号">
					  </el-table-column>
					  <el-table-column fixed prop="create_time" label="添加时间">
					  </el-table-column>
					</el-table>
				  </div>
				</div>
			</div>
				
			  </div>
			</div>
			
			<!-- 添加主合同 -->
			<el-dialog
			  title="添加主合同"
			  :visible.sync="zhuhetong"
			  width="50%"
			  :before-close="handleClose"
			>
			  <div style="width: 100%">
				<el-form ref="form" :model="form" label-width="150px">
				  <!-- <el-form-item label="合同编号">
					<el-input
					  v-model="form.company_code"
					  style="width: 200px"
					></el-input>
				  </el-form-item> -->
				  <el-form-item label="经销商">
					<el-input v-model="form.bh_id" style="width: 70px"></el-input>
					<el-input v-model="form.name" style="width: 200px"></el-input>
				  </el-form-item>
				  <!-- <el-form-item label="合同起草时间">
					<el-date-picker
					  v-model="currentDate"
					  type="date"
					  placeholder="选择日期"
					>
					</el-date-picker>
				  </el-form-item> -->
				  <el-form-item label="合同状态">
					<el-select disabled placeholder="请选择合同状态">
					  <el-option label="有效"></el-option>
					</el-select>
				  </el-form-item>
				  <el-form-item label="合同起始年月">
					<el-date-picker
					  type="date"
					  v-model="form.sq_start_date"
					  placeholder="选择日期"
					  format="yyyy-MM-dd"
					  value-format="yyyy-MM-dd"
					>
					</el-date-picker>
				  </el-form-item>
				  <el-form-item label="合同终止时间">
					<el-date-picker
					  type="date"
					  v-model="form.sq_end_date"
					  placeholder="选择日期"
					  format="yyyy-MM-dd"
					  value-format="yyyy-MM-dd"
					>
					</el-date-picker>
				  </el-form-item>
  
				  <el-form-item label="产品系列">
					<el-select
					  v-model="form.region"
					  style="width: 200px"
					  multiple
					  @change="handleSelectChange"
					>
					  <el-option
						v-for="item in sq_company_year"
						:key="item.id"
						:label="item.name"
						:value="item.id"
						:disabled="item.disabled"
					  >
					  </el-option>
					</el-select>
					<el-checkbox-group v-model="form.is_use_points">
					  <el-checkbox label="可使用积分" name="type"></el-checkbox>
					</el-checkbox-group>
				  </el-form-item>
				  <el-form-item style="float: left"> </el-form-item>
				  <template>
					<el-table
					  :data="zhuhetongtk"
					  border
					  style="width: 100%"
					  ref="multipleTable"
					  tooltip-effect="dark"
					  @selection-change="handleSelectionChange"
					>
					  <el-table-column type="selection" width="55">
					  </el-table-column>
					  <el-table-column
						fixed
						prop="hospital_area_name"
						label="医院或地区名称"
					  >
					  </el-table-column>
					  <el-table-column fixed prop="empower_code" label="授权编号">
					  </el-table-column>
					  <el-table-column fixed prop="bianhao" label="商采指标">
					  </el-table-column>
					</el-table>
				  </template>
				  <el-form-item label="">
					<div style="width: 80%">
					  <div
						style="margin-left: 20px; margin-top: 20px"
						v-for="(item, index) in chanpinxilie"
						:key="index"
					  >
						<div style="float: left">{{ item.abbreviation }}</div>
						<el-input
						  style="width: 200px; margin-left: 20px"
						  v-model="item.price"
						></el-input
						>元
					  </div>
					</div>
				  </el-form-item>
  
				  <el-form-item label="备注">
					<el-input type="textarea" v-model="form.remark"></el-input>
				  </el-form-item>
				  <el-form-item>
					<el-button type="primary" @click="onSubmitzhuht"
					  >申请</el-button
					>
					<el-button @click="quxiaosq">取消</el-button>
				  </el-form-item>
				</el-form>
			  </div>
			</el-dialog>
			<!-- 修改主合同 -->
			<el-dialog
			  title="修改主合同"
			  :visible.sync="zhuhetongxiugai"
			  width="50%"
			  :before-close="handleClose"
			>
			  <div style="width: 100%">
				<el-form ref="form" :model="form" label-width="150px">
				  <!-- <el-form-item label="合同编号">
					<el-input
					  v-model="form.company_code"
					  style="width: 200px"
					></el-input>
				  </el-form-item> -->
				  <el-form-item label="经销商">
					<el-input v-model="form.bh_id" style="width: 50px"></el-input>
					<el-input v-model="form.name" style="width: 200px"></el-input>
				  </el-form-item>
				  <!-- <el-form-item label="合同起草时间">
					<el-date-picker
					  v-model="currentDate"
					  type="date"
					  placeholder="选择日期"
					>
					</el-date-picker>
				  </el-form-item> -->
				  <el-form-item label="合同状态">
					<el-select disabled placeholder="请选择合同状态">
					  <el-option label="有效"></el-option>
					</el-select>
				  </el-form-item>
				  <el-form-item label="合同起始年月">
					<el-date-picker
					  type="date"
					  v-model="form.sq_start_date"
					  placeholder="选择日期"
					  format="yyyy-MM-dd"
					  value-format="yyyy-MM-dd"
					>
					</el-date-picker>
				  </el-form-item>
				  <el-form-item label="合同终止时间">
					<el-date-picker
					  type="date"
					  v-model="form.sq_end_date"
					  placeholder="选择日期"
					  format="yyyy-MM-dd"
					  value-format="yyyy-MM-dd"
					>
					</el-date-picker>
				  </el-form-item>
  
				  <el-form-item label="产品系列">
					<el-select
					  v-model="form.region"
					  style="width: 200px"
					  multiple
					  @change="handleSelectChange"
					>
					  <el-option
						v-for="item in sq_company_year"
						:key="item.id"
						:label="item.name"
						:value="item.id"
						:disabled="item.disabled"
					  >
					  </el-option>
					</el-select>
					<el-checkbox-group v-model="form.is_use_points">
					  <el-checkbox label="可使用积分" name="type"></el-checkbox>
					</el-checkbox-group>
				  </el-form-item>
				  <el-form-item style="float: left"> </el-form-item>
				  <template>
					<el-table
					  :data="zhuhetongtk"
					  border
					  style="width: 100%"
					  ref="multipleTable"
					  tooltip-effect="dark"
					  @selection-change="handleSelectionChange"
					>
					  <el-table-column type="selection" width="55">
					  </el-table-column>
					  <el-table-column
						fixed
						prop="hospital_area_name"
						label="医院或地区名称"
					  >
					  </el-table-column>
					  <el-table-column fixed prop="empower_code" label="授权编号">
					  </el-table-column>
					  <el-table-column fixed prop="bianhao" label="商采指标">
					  </el-table-column>
					</el-table>
				  </template>
				  <el-form-item label="">
					<div style="width: 80%">
					  <div
						style="margin-left: 20px; margin-top: 20px"
						v-for="(item, index) in chanpinxilie"
						:key="index"
					  >
						<div style="float: left">{{ item.ck_name }}</div>
						<el-input
						  style="width: 200px; margin-left: 20px"
						  v-model="item.price"
						></el-input
						>元
					  </div>
					</div>
				  </el-form-item>
  
				  <el-form-item label="备注">
					<el-input type="textarea" v-model="form.remark"></el-input>
				  </el-form-item>
				  <el-form-item>
					<el-button type="primary" @click="onSubmitzhuhtxg"
					  >修改</el-button
					>
					<el-button>取消</el-button>
				  </el-form-item>
				</el-form>
			  </div>
			</el-dialog>
		  </div>
		  <el-dialog
			title="日志信息"
			:visible.sync="tablistyb"
			width="30%"
			:before-close="handleClose"
		  >
			<div></div>
		  </el-dialog>
		  <el-dialog
			title="添加文件(主合同上传)"
			:visible.sync="tablistyb"
			width="30%"
			:before-close="handleClose"
		  >
			<el-form ref="form" :model="form" label-width="150px">
			  <el-form-item label="文件路径">
				<!-- 	<el-input v-model="form.name" style="width: 200px"></el-input> -->
				<el-upload
				  :action="uploadUrl"
				  list-type="text"
				  :on-success="handleSuccess"
				  :on-error="handleError"
				>
				  <el-button size="small" type="primary">点击上传</el-button>
				</el-upload>
			  </el-form-item>
  
			  <el-form-item label="文件名称">
				<el-input v-model="usernameimg" style="width: 200px"></el-input>
				<el-checkbox
				  :indeterminate="isIndeterminate"
				  v-model="checkAll"
				  @change="handleCheckAllChange"
				  >重命名</el-checkbox
				>
			  </el-form-item>
			  <el-form-item label="文件类型">
				<el-select v-model="usernamelei" placeholder="请选择文件类型">
				  <el-option
					v-for="item in shouquanlei"
					:key="item.id"
					:label="item.title"
					:value="item.id"
					:disabled="item.disabled"
				  > 
				  </el-option>
				 
				</el-select>
			  </el-form-item>
  
			  <el-form-item>
				<el-button type="primary" @click="onSubmitpsf">申请</el-button>
				<el-button @click="quxiaosq">取消</el-button>
			  </el-form-item>
			</el-form>
		  </el-dialog>
		  <el-dialog
			title="添加文件(补充合同上传)"
			:visible.sync="tablistybbuc"
			width="30%"
			:before-close="handleClose"
		  >
			<el-form ref="form" :model="form" label-width="150px">
			  <el-form-item label="文件路径">
				<!-- 	<el-input v-model="form.name" style="width: 200px"></el-input> -->
				<el-upload
				  :action="uploadUrl"
				  list-type="text"
				  :on-success="handleSuccess"
				  :on-error="handleError"
				>
				  <el-button size="small" type="primary">点击上传</el-button>
				</el-upload>
			  </el-form-item>
  
			  <el-form-item label="文件名称">
				<el-input v-model="usernameimg" style="width: 200px"></el-input>
				<el-checkbox
				  :indeterminate="isIndeterminate"
				  v-model="checkAll"
				  @change="handleCheckAllChange"
				  >重命名</el-checkbox
				>
			  </el-form-item>
			  <el-form-item label="文件类型">
				<el-select v-model="usernamelei" placeholder="请选择文件类型">
				  <el-option
					v-for="item in shouquanlei"
					:key="item.id"
					:label="item.title"
					:value="item.id"
					:disabled="item.disabled"
				  > 
				  </el-option>
				 
				</el-select>
			  </el-form-item>
  
			  <el-form-item>
				<el-button type="primary" @click="onSubmitpsf">申请</el-button>
				<el-button @click="quxiaosq">取消</el-button>
			  </el-form-item>
			</el-form>
		  </el-dialog>
		  <el-dialog
			title="单价明细信息"
			:visible.sync="mingxistataus"
			width="30%"
			:before-close="handleClose"
		  >
			<!-- <div>
			  <div>左心耳</div>
			  <div style="width: 80%; height: 200px; border: 1px solid #ccc">
				<div style="margin-left: 20px; margin-top: 20px">
				  <div style="float: left">房间隔穿刺针</div>
				  <el-input style="width: 200px"></el-input>元
				</div>
				<div style="margin-left: 20px; margin-top: 20px">
				  <div style="float: left">房间隔穿刺鞘</div>
				  <el-input style="width: 200px"></el-input>元
				</div>
			  </div>
			</div> -->
		  </el-dialog>
  
		  <div style="width: 100%; height: 100%; float: left; margin-top: 10px;">
			<el-dialog
			  title="添加补充合同"
			  :visible.sync="zhuhetongbc"
			  width="50%"
			  :before-close="handleClose"
			>
			  <div style="width: 100%">
				<el-form ref="form" :model="form" label-width="150px">
				  <el-form-item label="补充合同编号">
					<el-input
					  v-model="contract_code"
					  style="width: 200px"
					></el-input>
				  </el-form-item>
				  <el-form-item label="经销商">
					<el-input v-model="form.bh_id" style="width: 50px"></el-input>
					<el-input v-model="form.name" style="width: 200px"></el-input>
				  </el-form-item>
				  <el-form-item label="合同起草时间">
					<el-date-picker
					  v-model="currentDate"
					  type="date"
					  placeholder="选择日期"
					>
					</el-date-picker>
				  </el-form-item>
  
				  <el-form-item label="合同起始年月">
					<el-date-picker
					  type="date"
					  v-model="forms.sq_start_date"
					  placeholder="选择日期"
					  format="yyyy-MM-dd"
					  value-format="yyyy-MM-dd"
					>
					</el-date-picker>
				  </el-form-item>
				  <el-form-item label="合同终止时间">
					<el-date-picker
					  type="date"
					  v-model="forms.sq_end_date"
					  placeholder="选择日期"
					  format="yyyy-MM-dd"
					  value-format="yyyy-MM-dd"
					>
					</el-date-picker>
				  </el-form-item>
				  <el-form-item label="合同状态">
					<el-select
					  v-model="forms.region"
					 
					  placeholder="请选择合同状态"
					>
					  <el-option label="有效" value="0"></el-option>
					  <el-option label="结束" value="1"></el-option>
					</el-select>
				  </el-form-item>
				  <el-form-item label="授权申请编号">
					<el-input v-model="sqbianhao" style="width: 200px"></el-input>
				  </el-form-item>
				  <template>
					<el-table
					  :data="tableDatabcyydq"
					  border
					  ref="multipleTable"
					  tooltip-effect="dark"
					  style="width: 100%"
					  @selection-change="handleSelectionChange"
					>
					  <el-table-column type="selection" width="55">
					  </el-table-column>
					  <el-table-column  prop="company_name" label="医院地区名称">
					  </el-table-column>
					  <el-table-column
						
						prop="rule_code"
						label="积分规则申请编号"
					  >
					  </el-table-column>
					</el-table>
				  </template>
				  <template>
					<el-table
					  :data="tableDatabc"
					  border
					 :header-cell-style="{background:'#f5f7fa',color:'#606266'}"
					>
					  <el-table-column type="selection" width="55">
					  </el-table-column>
					  <el-table-column fixed prop="name" label="明细条目">
					  </el-table-column>
					  <el-table-column fixed prop="rouds" label="明细内容">
					  </el-table-column>
					  <el-table-column fixed prop="bianhao" label="备注">
					  </el-table-column>
					</el-table>
				  </template>
  
				  <el-form-item label="备注">
					<el-input type="textarea" v-model="forms.desc"></el-input>
				  </el-form-item>
				  <el-form-item>
					<el-button type="primary" @click="onSubmitzhuhtbc"
					  >申请</el-button
					>
					<el-button @click="quxiaosq()">取消</el-button>
				  </el-form-item>
				</el-form>
			  </div>
			</el-dialog>
			<div style="width: 100%; height: 100%; float: left">
			  <div class="my-body_center">
				<div>
				  <!-- <el-button type="primary" @click="zhuhetongbc = true" plain
					>添加补充合同</el-button
				  >
				  <el-button type="danger" plain>删除(作废)补充合同</el-button> -->
				</div>
				<template>
				  <el-table
					:data="bc_contract_list"
					border
					style="width: 100%; overflow: auto"
				   :header-cell-style="{background:'#f5f7fa',color:'#606266'}"
					ref="singleTablebucun"
					highlight-current-row
					height="300"
					@current-change="handleCuChangebucun"
				  >
					<el-table-column
					  fixed
					  prop="contract_code"
					  label="合同编号"
					  width="250"
					>
					</el-table-column>
					<el-table-column
					  fixed
					  prop="start_time"
					  label="合同起始时间"
					  width="120"
					>
					</el-table-column>
					<el-table-column
					  fixed
					  prop="end_time"
					  label="合同终止时间"
					  width="120"
					  format="yyyy-MM-dd"
					  value-format="yyyy-MM-dd"
					>
					</el-table-column>
					<el-table-column prop="senddate" label="合同状态" width="200">
					  <template slot-scope="scope">
						
						<el-button  v-if="scope.row.is_operation  == 0">{{scope.row.status_txt}}</el-button>
					<el-button @click="fuhezhong(scope.$index, scope.row)" v-else>{{scope.row.status_txt}}</el-button>
					
					
			  
				
					  
					  </template>
					</el-table-column>
					<el-table-column prop="senddate" label="物流编号" width="200">
						<template slot-scope="scope">
						<el-input v-model="scope.row.track_number" placeholder="请输物流编号"
					></el-input>
				</template>
					</el-table-column>
					<el-table-column
					  prop="senddate"
					  label="回执倒计时"
					  width="120"
					>
					</el-table-column>
					<el-table-column
					  prop="create_time"
					  label="发布时间"
					  width="120"
					>
					</el-table-column>
					<el-table-column prop="senddate" label="回执时间" width="120">
					</el-table-column>
					<el-table-column prop="senddate" label="价格明细" width="120">
					  <el-button @click="mingxi()" type="text" size="mini"
						>明细</el-button
					  >
					</el-table-column>
					<el-table-column prop="senddate" label="合同上传" width="120">
					 
					  <template slot-scope="scope">
					
					<el-button @click="zhuhetongscbuc(scope.$index, scope.row)" type="text" size="mini" v-if="scope.row. status ==2"
						>上传</el-button
					  >
					  <el-button @click="zhuhetongscbuc(scope.$index, scope.row)" type="text" size="mini" v-else
						>已上传</el-button
					  >
				  </template>
					</el-table-column>
					<el-table-column prop="senddate" label="操作日志" width="120">
					  <template slot-scope="scope">
						<el-button @click="caozuorizhi(scope.$index, scope.row)" type="text" size="mini"
						>操作日志</el-button
					  >
				  
				  </template>
					</el-table-column>
				  </el-table>
				</template>
			  </div>
			  <div class="my-body_center_left">
				<div
				  style="
					width: 100%;
					height: 200px;
					float: left;
					margin-top: 20px;
				  "
				>
				  <div style="width:100%; height: 200px; float: left">
					<div>补充合同授权医院或地区</div>
					<el-table
					  :data="bc_hospital_list"
					  border
					
					  :header-cell-style="{background:'#f5f7fa',color:'#606266'}"
					 height="300"
					  style="width: 100%; margin-top: 20px; overflow: auto"
					>
					  <el-table-column
						fixed
						prop="hospital_name"
						label="医院或地区名称"
						width="200"
					  >
					  </el-table-column>
					</el-table>
				  </div>
				  
				</div>
			  </div>
			  <div class="my-body_center_left">
				<div
				  style="
					width: 100%;
					height: 200px;
					float: left;
					margin-top: 20px;
				  "
				>
				<div>
				<div style="width: 100%; height: 200px; float: left">
					<div>补充合同-明细条目</div>
					<el-table
					  :data="bc_detail_list"
					  border
					  :header-cell-style="{background:'#f5f7fa',color:'#606266'}"
					   height="300"
					  style="width: 100%; margin-top: 20px"
					>
					  <el-table-column fixed prop="one" label="条目">
					  </el-table-column>
					  <el-table-column prop="bianhao" label="内容">
					  </el-table-column>
					  <el-table-column prop="bianhao" label="备注">
					  </el-table-column>
					</el-table>
				  </div>
			  </div>
				  
				</div>
			  </div>
			  
			</div>
		  </div>
		</div>
		<div></div>
	  </div>
	</div>
  </template>
  
  <script>
  import { getData, postData, request } from "@/utils/request.js";
  export default {
	data() {
	  return {
		zhuhetong: false,
		zhuhetongbc: false,
		tablisty: false,
		tablistya: false,
  
		input: "",
		key: 1, // 为了能每次切换权限的时候重新初始化指令
		options: [
		  {
			value: "1",
			label: "全部",
		  },
		  {
			value: "2",
			label: "一般订单",
		  },
		  {
			value: "3",
			label: "积分订单",
		  },
		  {
			value: "3",
			label: "样品订单",
		  },
		  {
			value: "3",
			label: "换货订单",
		  },
		],
		zhuhetongxiugai:false,
		value1: "",
		value2: "",
		value3: "",
		track_number:"",
		form: {
		  name: "",
		  company_code: "",
		  product_type_price: "",
		  sq_start_date: "",
		  sq_end_date: "",
		  is_use_points: "",
		  remark: "",
		  content: "",
		  bh_id: "",
		  region:[],
		},
		forms: {
		  name: "",
		  company_code: "",
		  product_type_price: "",
		  sq_start_date: "",
		  sq_end_date: "",
		  is_use_points: "",
		  remark: "",
		  content: "",
		  bh_id: "",
		  region:[],
		},
		radio: "授权医院",
		value: "",
		tableData: [],
		tableDataqiye: [],
		currentPage: 1,
		pageSize: 100,
		checkAll: false,
		checkedCities: [],
		multipleTable: [],
		cities: [
		  "房间隔缺损",
		  "室间隔缺损",
		  "介入输送装置",
		  "动脉导管未闭",
		  "抓捕器",
		],
		isIndeterminate: true,
		totallist: "",
		currentPages: 1,
		pageSizes: 100,
		currentRow: null,
		qiyelistlx: [],
		sq_company_year: [],
		mingxistataus: false,
		tablistyb: false,
		usernameimg: "",
		usernamelei: "",
		uploadUrl: "http://192.168.3.184:8093/api/index/uploadFile",
		main_hospital: [],
		main_file_url: [],
		bc_contract_list: [],
		bc_id: "",
		main_id: "",
		bc_hospital_list: [],
		chanpinxilie: [],
		zhuhetongtk: [],
		sqbianhao: "",
		tableDatabcyydq: [],
		tableDatabc: [],
		hospital_id:"",
		bc_content:[],
		file_url:"",
		company_id:"",
		shouquanlei:[],
		xinxilist:[],
		rizhixinxi:false,
		contract_code:"",
		bc_detail_list:[],
		tablistybbuc:false,
		ht_id:"",
	  };
	},
	created() {
		this.company_id = localStorage.getItem('company_id')
	  this.qiyelisttab();
	  this.bucunlist();
	  this.scwjlist()
	 
	  this.qiyeshouquan();
      this.hetongtab();
	},
	computed: {
	  lastDayOfYear() {
		let currentDate = new Date();
		let year = currentDate.getFullYear();
		let month = currentDate.getMonth() + 1; // 注意月份从0开始，需要加1
		let day = currentDate.getDate();
		this.form.sq_end_date = year + "-" + month + "-" + day;
		return year + "-" + month + "-" + day;
	  },
	  currentDate() {
		let currentDate = new Date();
		let year = currentDate.getFullYear();
		let month = currentDate.getMonth() + 1; // 注意月份从0开始，需要加1
		let day = currentDate.getDate();
		this.form.sq_start_date = year + "-" + month + "-" + day;
		return year + "-" + month + "-" + day;
	  },
	},
	watch: {
	  selectedValue(newVal) {
		const option = this.options.find((item) => item.name === newVal);
		this.selectedLabel = option ? option.label : "";
	  },
	},
	methods: {
	  fuhezhong(index,row){
		 console.log(index,row)
		var data = {
		  status: row.status,
		  contract_id:row.id,
		  track_number:row.track_number,
		  token: localStorage.getItem("token"),
		};
  
		postData("company.contract/updateStatus", data).then((res) => {
		  console.log(res);
	   
		 
		 });
	  },
	  huizhi(index,row){
	   console.log(index,row)
	  },
	  zhuhetongtj(){
		this.form.sq_end_date = ""
		this.zhuhetongtk =[]
		this.chanpinxilie =  []
		this.form.region = []
		this.form.remark = []
		this.zhuhetong = true
		this.form.remark = ""
	  },
	  //编辑合同详情
	  handleEdit(val) {
		this.xgzhtid = val.id
		var data = {
		  id: val.id,
		  token: localStorage.getItem("token"),
		};
  
		postData("company.contract/info", data).then((res) => {
		  console.log(res);
		 this.form.sq_end_date = res.data.end_time
		 this.zhuhetongtk = res.data.content
		 this.chanpinxilie = res.data.product_type_price
		 this.form.remark = res.data.remark
		 var arr = []
		 res.data.product_type_price.forEach(element => {
		
		  arr.push(element.pid) 
		  
		 
		 });
		 let uniqueArr = [...new Set(arr)];
		  this.form.region  = uniqueArr
		 console.log(this.form.region)
		 
		});
		console.log(val);
		this.zhuhetongxiugai =true
	  },
	  //补充合同添加数据
	  bucunhetongtj(e) {
		this.tableDatabcyydq = []
		this.hospital_id = e
		var data = {
		  hospital_area_id: e,
		  company_id: this.company_id,
		  token: localStorage.getItem("token"),
		};
  
		postData("company.contract/getParams_bc", data).then((res) => {
		   var arr =[]
		  arr.push(res.data)
		 for(var i=0; i<arr.length; i++){
		  for(var j=i+1; j<arr.length; j++){
			  if(arr[i].danNo==arr[j].danNo){
				  arr.splice(j,1);
				  j--;
			  }
		  }
	  }
	  this.tableDatabcyydq = arr
	  this.points_rule_id = res.data.id
	  this.bc_content = res.data.settings
  
		  console.log(res.data.settings.dtjf
		  ,8888888888)
	  var name = [{
		   name:"单台积分",
		   rouds:res.data.settings.dtjf.ok
	  },{
		   name:"订单积分使用率",
		   rouds:res.data.settings.dtjf.ok
	  },{
		   name:"Q1植入指标",
		   rouds:res.data.settings.dtjf.Q1
	  },{
		   name:"Q2植入指标",
		   rouds:res.data.settings.dtjf.Q2
	  },{
		   name:"Q3植入指标",
		   rouds:res.data.settings.dtjf.Q3
	  },{
		   name:"Q4植入指标",
		   rouds:res.data.settings.dtjf.Q4
	  },]
	  this.tableDatabc = name
		});
	  },
	  handleSelectionChange(val) {
		console.log(val)
		this.multipleTable = val;
		console.log(this.multipleTable);
	  },
	  handleSelectChange(value) {
		this.chanpinxilie = [];
		this.zhuhetongtk = [];
		console.log("选中的值：", value);
		var listpids = value.join(",");
		this.checkAlla = false;
		if (listpids == "") {
		} else {
		  var data = {
			product_type_pid: listpids,
			company_id: this.company_id,
			token: localStorage.getItem("token"),
		  };
  
		  postData("company.empower/getHospitalProduct", data).then((res) => {
			// 处理响应数据
			if (res.code == 0) {
			  this.chanpinxilie = res.data.product_type;
			  this.zhuhetongtk = res.data.hospital_area;
			} else {
			}
		  });
		}
  
		// this.tablistxz(listpids)
	  },
	  // tablistxz(product_type_id){
	  //   var data = {
	  //     product_type_pid: product_type_id,
	  //     company_id:this.currentRow.id,
	  //     token: localStorage.getItem("token"),
	  //   };
	  //   postData("company.empower/getHospitalProduct", data).then((res) => {
	  //     // 处理响应数据
	  //     if (res.code == 0) {
	  //       console.log(res, 66666);
	  //       // this.chanpinxilie = res.data.product_type_list
  
	  //     } else {
  
	  //     }
	  //   });
	  // },
	  caozuorizhi(index,row) {
	   
		this.rizhixinxi = true
		this.xinxilist  = []
		var data = {
		  id: row.id,
		  token: localStorage.getItem("token"),
		 
		};
		postData("company.contract/getLogList", data).then((res) => {
		  console.log(res);
		  this.xinxilist = res.data
		});
			 
	
	  },
	  handleError() {},
	  scwjlist(){
		
		var data = {
		  token: localStorage.getItem("token"),
		  type:4,
		};
		postData("index/fileParams", data).then((res) => {
		  console.log(res, 6666666666);
		  this.shouquanlei = res.data.file_type;
		  this.usernamelei = res.data.file_type[1].id;
		});
	  },
	  handleSuccess(response, file, fileList) {
		console.log("文件上传成功", file);
		this.usernameimg = file.name
		this.file_url = response.data.file
		console.log("文件上传成功", response);
	  },
	  onSubmitpsf() {
		var data = {
		  token: localStorage.getItem("token"),
		  contract_id:this.ht_id,
		  file_url:this.file_url,
		  file_name:this.usernameimg ,
		  file_type:this.usernamelei,
		};
		postData("company.contract/updateFile", data).then((res) => {
		  console.log(res, 6666666666);
		});
	  },
	  quxiaosq() {
		this.tablistyb =false
		this.zhuhetongbc = false
		this.zhuhetong = false
		this.zhuhetongxiugai =false
	  },
	  bucunlist() {
		var data = {
		  token: localStorage.getItem("token"),
		};
		postData("company.contract/indexlist_bc", data).then((res) => {
		  console.log(res, 6666666666);
		});
	  },
	  mingxi() {
		this.mingxistataus = true;
	  },
	  zhuhetongsc(index,row) {
		console.log(index,row)
		this.ht_id = row.id
		this.tablistyb = true;
	  },
	  zhuhetongscbuc(index,row) {
		console.log(index,row)
		this.ht_id = row.id
		this.tablistybbuc = true;
	  },
	 
	  //经销商列表
	  hetongtab() {
		var data = {
		  token: localStorage.getItem("token"),
		  company_id: this.company_id,
		};
		postData("company.contract/getParams", data).then((res) => {
		  this.sq_company_year = res.data.product_type_list;
		});
	  },
	  //经销商取值查询主合同与授权数据
	  qiyeshouquan() {
		var data = {
		  company_id: this.company_id,
		  token: localStorage.getItem("token"),
		};
		postData("company.Contract/getCompanyInfo", data).then((res) => {
		  console.log(res);
  
		  this.qiyelistlx = res.data.empowerlist;
		  console.log(this.qiyelistlx);
		  this.tableData = res.data.main_contractlist;
		  this.setCurrentzhu();
		  this.handleCuChangezhu(this.tableData[0]);
		});
	  },
	  //主合同取值查询授权数据
	  fuhetong() {
		var data = {
		  main_id: this.main_id.id,
		  token: localStorage.getItem("token"),
		};
		postData("company.Contract/getMainContractInfo", data).then((res) => {
		  console.log(res, "-------------");
		  this.main_hospital = res.data.main_hospital;
		  this.main_file_url = res.data.main_file_url;
		  this.bc_contract_list = res.data.bc_contract_list;
		  this.setCurrentbucun();
		  this.handleCuChangebucun(this.bc_contract_list[0]);
  
		  this.zhuhetlist();
		  this.handlezhuhetongsq(this.main_hospital[0]);
		});
	  },
	  //补充合同取值查询授权数据
	  fuhetongqs() {
		var data = {
		  bc_id: this.bc_id.id,
		  token: localStorage.getItem("token"),
		};
		postData("company.Contract/getBcContractInfo", data).then((res) => {
		  this.bc_hospital_list = res.data.bc_hospital_list;
		  this.bc_detail_list = res.data.bc_detail_list;
		  // this.main_file_url = res.data.main_file_url;
		  // this.bc_contract_list = res.data.bc_contract_list;
		});
	  },
	  //默认经销商第一条取值
	  handleCuChange(val) {
		console.log(val);
		this.currentRow = val;
		this.form.bh_id = val.company_code;
		this.form.name = val.name;
		this.qiyeshouquan();
		this.hetongtab();
	  },
	  //默认主合同第一条取值
	  handleCuChangezhu(val) {
		this.htid = val.id
		console.log(val,66666666666666)
		if (val == undefined || val == null) {
		  this.main_hospital = [];
		  this.main_file_url = [];
		  this.bc_contract_list = [];
		} else {
		  this.main_id = val;
		  this.contract_code = val.contract_code;
		  this.fuhetong();
		}
	  },
	  //默认补充合同第一条取值
	  handleCuChangebucun(val) {
		if (val == undefined || val == null) {
		  this.bc_hospital_list = [];
		  this.bc_detail_list = [];
		} else {
		  this.bc_id = val;
		  this.fuhetongqs();
		}
	  },
	  //默认选中主合同授权医院或地区
	  handlezhuhetongsq(val) {
		console.log(val)
		this.hospital_id = val.hospital_area_id
		this.bucunhetongtj(val.hospital_area_id);
	  },
	  //主合同医院或地区默认第一条
	  zhuhetlist() {
		this.$refs.zhuhetongsq.setCurrentRow(this.main_hospital[0]);
	  },
	  //经销商默认第一条
	  setCurrent() {
		this.$refs.singleTable.setCurrentRow(this.tableDataqiye[0]);
	  },
	  //主充合同默认第一条
	  setCurrentzhu() {
		this.$refs.singleTablezhu.setCurrentRow(this.tableData[0]);
	  },
	  //补充合同默认第一条
	  setCurrentbucun() {
		this.$refs.singleTablebucun.setCurrentRow(this.bc_contract_list[0]);
	  },
	  qiyelisttab() {
		var data = {
		  page:this.currentPages,
		  limit:this.pageSizes,
		  token: localStorage.getItem("token"),
		};
		postData("company/indexList", data).then((res) => {
		  this.tableDataqiye = res.data.data;
		  this.totallist = res.data.total;
		  this.setCurrent();
		});
	  },
	  // hetonglist() {
	  //   var data = {
	  //     token: localStorage.getItem("token"),
	  //   };
	  //   postData("company.contract/indexlist", data).then((res) => {
	  //     this.tableData = res.data.data;
	  //   });
	  // },
	  handleClick(row) {
		console.log(row);
	  },
	  handleClose() {
		this.zhuhetong = false;
		this.mingxistataus = false;
		this.tablistyb = false;
		this.zhuhetongbc = false;
		this.zhuhetongxiugai = false;
		this.rizhixinxi = false;
		this.tablistybbuc = false
	   
	  },
	  //新增主合同
	  onSubmitzhuht() {
		var product_type_price = JSON.stringify(this.chanpinxilie);
		if (this.form.is_use_points == true) {
		  var is_use_points = 1;
		} else {
		  var is_use_points = 2;
		}
		var data = {
		  token: localStorage.getItem("token"),
		  company_id: this.company_id,
		  company_code: this.form.bh_id,
		  product_type_price: product_type_price,
		  start_time: this.form.sq_start_date,
		  end_time: this.form.sq_end_date,
		  remark: this.form.remark,
		  is_use_points: is_use_points,
		  empower_ids: this.form.empower_ids,
		  content: JSON.stringify(this.multipleTable),
		};
  
		postData("company.contract/operation", data).then((res) => {
		  if (res.code == 0) {
			
			this.$message({
			  message: "添加成功",
			  type: "success",
			});
		  } else {
			console.log(res, 66666);
			this.$message.error(res.msg);
		  }
		});
	  },
	  //修改主合同
	  onSubmitzhuhtxg() {
		this.zhuhetongxiugai = false
		var product_type_price = JSON.stringify(this.chanpinxilie);
		if (this.form.is_use_points == true) {
		  var is_use_points = 1;
		} else {
		  var is_use_points = 2;
		}
		var data = {
		  id:this.xgzhtid,
		  token: localStorage.getItem("token"),
		  company_id: this.company_id,
		  company_code: this.form.bh_id,
		  product_type_price: product_type_price,
		  start_time: this.form.sq_start_date,
		  end_time: this.form.sq_end_date,
		  remark: this.form.remark,
		  is_use_points: is_use_points,
		  empower_ids: this.form.empower_ids,
		  content: JSON.stringify(this.multipleTable),
		};
  
		postData("company.contract/operation", data).then((res) => {
		  if (res.code == 0) {
			
			this.$message({
			  message: "修改成功",
			  type: "success",
			});
		  } else {
			console.log(res, 66666);
			this.$message.error(res.msg);
		  }
		});
	  },
	  //添加补充合同
	  onSubmitzhuhtbc(){
		var data = {
		  token: localStorage.getItem("token"),
		  company_id: this.company_id,
		  company_code: this.form.bh_id,
		  start_time:this.forms.sq_start_date,
		  end_time:this.forms.sq_end_date,
		  remark:this.forms.remark,
		  content: JSON.stringify(this.bc_content),
		  contract_id:this.main_id.id,
		  contract_code:this.contract_code,
		  hospital_id:this.hospital_id,
		  points_rule_id:this.points_rule_id,
		  status:this.status,
		};
  
		postData("company.contract/operation_bc", data).then((res) => {
		  if (res.code == 0) {
			
			this.$message({
			  message: "添加成功",
			  type: "success",
			});
		  } else {
			console.log(res, 66666);
			this.$message.error(res.msg);
		  }
		});
	  },
	  handleSizeChange(val) {
		this.pageSizes = val;
	  },
	  handleCurrentChange(val) {
		this.currentPages = val;
	  },
	  handleClick(row) {
		console.log(row);
	  },
	  handleCheckAllChange(val) {
		const cityOptions = ["上海", "北京", "广州", "深圳"];
		console.log(val);
		this.checkedCities = val ? cityOptions : [];
  
		this.isIndeterminate = false;
	  },
	  handleCheckedCitiesChange(value) {
		let checkedCount = value.length;
		this.checkAll = checkedCount === this.cities.length;
		this.isIndeterminate =
		  checkedCount > 0 && checkedCount < this.cities.length;
	  },
	},
  };
  </script>
  
  <style lang="scss" scoped>
  .ipt_a {
	width: 260px;
	height: 50px;
	float: left;
  }
  
  .ipt_b {
	width: 450px;
	height: 50px;
	float: left;
  }
  </style>